# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Simon Sapin <simon dot sapin at exyr dot org>
# Contributor: Kyle Keen <keenerd@gmail.com>

pkgname=python-mongoengine
pkgver=0.24.2
pkgrel=2
pkgdesc="A Python Object-Document-Mapper for working with MongoDB"
url="https://github.com/MongoEngine/mongoengine"
license=('MIT')
arch=('any')
depends=('python-pymongo')
optdepends=('python-dateutil: for DateTimeField'
            'python-pillow: for ImageField / ImageGridFsProxy')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
checkdepends=('python-pytest-cov' 'python-coverage' 'python-blinker' 'python-pillow' 'python-zipp'
              'python-mongomock')
source=("https://github.com/MongoEngine/mongoengine/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('24e855e1da89d01b63e02a3476167efe6de2186eb17b091504605263c02efe1d9e128b6e3dbb7dace1926db9006ad79d7f1f675f58e66491e14426e398ab6aa1')

build() {
  cd mongoengine-$pkgver
  python -m build -nw
}

check() {
  cd mongoengine-$pkgver
  # No sane way to run it without mongodb
  # python -m pytest
}

package() {
  cd mongoengine-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
